package com.jh.paymentchannel.repository;

import com.jh.paymentchannel.pojo.SDJRegister;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface SDJRepository extends JpaRepository<SDJRegister, String>, JpaSpecificationExecutor<SDJRegister>{
	
	
	@Query("select sdj from  SDJRegister sdj where sdj.userId=:userId and sdj.bankCard=:bankCard")
	public SDJRegister	getSDJRegisterByUseridAndBankCard(@Param("userId") long userId, @Param("bankCard") String bankCard);
	
	@Query("select sdj from  SDJRegister sdj where sdj.userId=:userId")
	public SDJRegister	getSDJRegisterByUserid(@Param("userId") long userId);
	
	//注销用户记录
	@Modifying
	@Query("delete from SDJRegister sdj where sdj.userId=:userid")
	void delSDJRegisterByUserid(@Param("userid") long userid);
}
